import re
from django.db.models import Prefetch
from user.models import *

from rest_framework import filters
from rest_framework import mixins
from rest_framework import permissions
from rest_framework import viewsets
from rest_framework import status
from rest_framework.response import Response
from rest_framework.views import APIView
from rest_framework.parsers import MultiPartParser, FileUploadParser

from django_filters.rest_framework import DjangoFilterBackend

from tool import restful
from tool.paginations import CommonPagination
from user.models import *
from .models import *
from .serializers import *
from rewrite.my_modelviewset import MyModelViewSet
from rewrite.my_mixins import MyListModelMixin, MyCreateModelMixin
# 虚拟币
class TMgoldViewSet(MyModelViewSet):
    """
    虚拟币
    """
    queryset = TMgold.objects.filter(deleted__exact='0')            # 对应模型数据集和
    serializer_class = TMgoldSerializer                             # 经过序列化器
    permission_classes = [permissions.IsAuthenticated]              # 权限限制
    pagination_class = CommonPagination                             # 分页

# 虚拟币下拉选
class TMgoldOptionViewSet(MyModelViewSet):
    """
    虚拟币下拉选
    """
    queryset = TMgold.objects.filter(deleted__exact='0')            # 对应模型数据集和
    serializer_class = TMgoldOptionSerializer                             # 经过序列化器
    permission_classes = [permissions.IsAuthenticated]              # 权限限制
    pagination_class = CommonPagination                             # 分页

# 事件链
class TMgoldToEventViewSet(MyModelViewSet):
    """
    事件链
    """
    queryset = TMgoldToEvent.objects.filter(deleted__exact='0')            # 对应模型数据集和
    serializer_class = TMgoldToEventSerializer                             # 经过序列化器
    permission_classes = [permissions.IsAuthenticated]              # 权限限制
    pagination_class = CommonPagination                             # 分页

# 事件链下拉选
class TMgoldToEventOptionViewSet(MyModelViewSet):
    """
    事件链下拉选
    """
    queryset = TMgoldToEvent.objects.filter(deleted__exact='0')            # 对应模型数据集和
    serializer_class = TMgoldToEventOptionSerializer                             # 经过序列化器
    permission_classes = [permissions.IsAuthenticated]              # 权限限制
    pagination_class = CommonPagination                             # 分页

# AllGold 总数据
class AllGoldViewSet(MyModelViewSet):
    """
    总数据
    """
    queryset = AllGold.objects.filter(deleted__exact='0')            # 对应模型数据集和
    serializer_class = AllGoldSerializer                             # 经过序列化器
    permission_classes = [permissions.IsAuthenticated]              # 权限限制
    pagination_class = CommonPagination                             # 分页


